package com.tanhua.server.controller;

import com.tanhua.model.vo.SoundVo;
import com.tanhua.server.service.SoundService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RestController
@RequestMapping("/peachblossom")
public class SoundController {
    @Autowired
    private SoundService soundService;
    //发送语音
    @PostMapping
    public ResponseEntity saveSound(MultipartFile soundFile) throws IOException {
        soundService.saveSound(soundFile);
        return ResponseEntity.ok(null);
    }

    @GetMapping
    public ResponseEntity getSound(){
        SoundVo vo=soundService.getSound();
        return ResponseEntity.ok(vo);
    }
}
